<?php
/**
+--------------------------------------------------------------
 * User: maqun
+--------------------------------------------------------------
 * Date: 2015/12/16
+--------------------------------------------------------------
 * Time: 9:58
+--------------------------------------------------------------
 * MoodleModel 处理用户登录
+--------------------------------------------------------------
 */
class MoodleModel extends BaseModel{

//    protected $tableName = "user";//数据库表名
      protected $moodle_salt= '-Y9-h0;),c@<i)D~*i/j7.pD6lh/,B';

    public function checkLogin($user_id,$pass){

        $return = false;
        $sql="select password from mdl_user where username='{$user_id}'";
        $password = md5($pass.$this->moodle_salt);
        $res = $this->db(1,C('DB_CONFIG_2'))->query($sql);
        if(!empty($res) && $password==$res[0]['password']){
            $return = $row[0]['username'];
        }
        return $return;
    }
}